package models

import "time"

// Article 文章主表（高频访问字段）
type Article struct {
	ID           uint64    `gorm:"primaryKey;comment:文章ID"`
	Title        string    `gorm:"type:varchar(150);not null;index;comment:标题"`
	Alias        string    `gorm:"type:varchar(150);not null;index;comment:标题英文或拼音"`
	AuthorID     uint64    `gorm:"not null;index;comment:作者ID"`
	CategoryID   uint64    `gorm:"index;comment:分类ID"`
	Status       int8      `gorm:"default:1;index;comment:状态 1草稿 2发布 3下架"`
	IsTop        bool      `gorm:"default:0;comment:是否置顶"`
	ViewCount    uint      `gorm:"default:0;index;comment:浏览数"`
	LikeCount    uint      `gorm:"default:0;index;comment:点赞数"`
	CommentCount uint      `gorm:"default:0;index;comment:评论数"`
	PublishedAt  time.Time `gorm:"index;comment:发布时间"`
	CreatedAt    time.Time `gorm:"autoCreateTime;comment:创建时间"`
	UpdatedAt    time.Time `gorm:"autoUpdateTime;comment:更新时间"`
}

func (Article) TableName() string {
	return "articles"
}
